import Vue from 'vue'
import Router from 'vue-router'
import Index from './pages/index'
import Home from './pages/home'
import Product from './pages/product'
import Detail from './pages/detail'
import Cart from './pages/cart'
import Order from './pages/order'
import OrderConfirm from './pages/orderConfirm'//确认订单
import OrderList from './pages/orderList'//订单列表
import OrderPay from './pages/orderPay'//订单支付
import Alipay from "./pages/alipay";
import Login from "./pages/login";
Vue.use(Router)
export default new Router({
  routes:[
      {
    path:'/',
    name:'home',//主页
    component:Home,
    redirect:'/index',
    children:[
        {
        path:'/index',
        name:'index',
        component:Index,
    },
    {
        path:'/product/:id',//动态路由
        name:'product',//商品
        component:Product,
    },
    {
        path:'/detail/:id',//动态路由
        name:'detail',
        component:Detail,
    }]
},

{
    path: '/login',
    name: 'Login',
    component:Login
  },
    {
        path:'/cart',
        name:'cart',//购物车
        component:Cart,
    },
    {
        path:'/order',
        name:'order',//订单
        component:Order,
        children:[
            {
            path:'list',
            name:'order-list',//订单列表
            component:OrderList,
    
        },
        {
            path:'confirm',
            name:'order-confirm',////确认订单
            component:OrderConfirm,
    
        },
        {
            path:'pay',
            name:'order-pay',//订单支付
            component:OrderPay,
    
        },
        {
            path:'alipay',
            name:'alipay',//订单支付
            component:Alipay,
    
        },


    ]
    },


]
    
})
